package com.smart.nine.spel.expr;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * user
 *
 * @author junrui.wang
 * @create 2019/3/19
 */
public class User {
    private String name;
    private int credits;
    private Date lastVisit;
    private PlaceOfBirth placeOfBirth;
    private List interestsArray;
    private Map interestsMap;

    public User() {
    }

    public User(String name, int credits) {
        this.name = name;
        this.credits = credits;
    }

    public int getCredits() {
        return credits;
    }

    public void setCredits(int credits) {
        this.credits = credits;
    }

    public String getName() {

        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public boolean isVipMember(String name) {
        if (name.equalsIgnoreCase("Tom") || name.equalsIgnoreCase("John")){
            return true;
        }
        return false;
    }

    public Date getLastVisit() {
        return lastVisit;
    }

    public void setLastVisit(Date lastVisit) {
        this.lastVisit = lastVisit;
    }

    public PlaceOfBirth getPlaceOfBirth() {
        return placeOfBirth;
    }

    public void setPlaceOfBirth(PlaceOfBirth placeOfBirth) {
        this.placeOfBirth = placeOfBirth;
    }

    public List getInterestsArray() {
        return interestsArray;
    }

    public void setInterestsArray(List interestsArray) {
        this.interestsArray = interestsArray;
    }

    public Map getInterestsMap() {
        return interestsMap;
    }

    public void setInterestsMap(Map interestsMap) {
        this.interestsMap = interestsMap;
    }

    public boolean validatePassword(String password){
        if(password.equalsIgnoreCase("123456")){
            return true;
        }
        return false;
    }

    private boolean validatePassword2(String password){
        if(password.equalsIgnoreCase("123456")){
            return true;
        }
        return false;
    }

    public static boolean validatePassword3(String password){
        if(password.equalsIgnoreCase("123456")){
            return true;
        }
        return false;
    }

    public boolean addInterests(String ... interests){
        System.out.println(interests.toString());
        return true;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("User{");
        sb.append("name='").append(name).append('\'');
        sb.append(", credits=").append(credits);
        sb.append(", lastVisit=").append(lastVisit);
        sb.append(", placeOfBirth=").append(placeOfBirth);
        sb.append('}');
        return sb.toString();
    }
}
